let id = 0

class Dep {
    constructor(){
        this.subs = []
        this.id = id++;
    }
    depend(){
        if(Dep.target){
            Dep.target.addDep(this)
        }
    }
    addSubs(watcher){
        this.subs.push(watcher)
    }
    notify(){
        this.subs.forEach(watcher => {
            watcher.update()
        })
    }
}

export default Dep

